package com.example.plan.common;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;

/**
 * 通用的分页请求类
 */
@Data
public class PageRequest implements Serializable {


    private static final long serialVersionUID = 3469351055049589652L;
    /**
     * 当前页号
     */
    @NotNull(message="当前页号不能为空")
    @ApiModelProperty(value = "当前页号", required = true)
    private int current = 1;

    /**
     * 页面大小
     */
    @NotNull(message="页面大小不能为空")
    @ApiModelProperty(value = "页面大小", required = true)
    private int pageSize = 10;

    /**
     * 排序字段
     */

    @ApiModelProperty(value = "排序字段")
    private String sortField;

    /**
     * 排序顺序（默认升序）
     */
    @NotNull(message="排序顺序不能为空")
    @ApiModelProperty(value = "排序顺序（1:升序、2:降序）",required = true)
    private int sortOrder ;
}